<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBookAppliesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('book_applies', function (Blueprint $table) {
            $table->id();
            $table->string('uuid', 32)->unique()->comment('编号');
            $table->string('name');
            $table->string('inventor')->nullable();
            $table->string('first_inventor')->nullable();
            $table->string('applicant')->nullable();
            $table->string('mobile')->nullable();
            $table->text('cts')->nullable();
            $table->string('file')->nullable();
            $table->string('file2')->nullable();
            $table->tinyInteger('status')->default(0);
            $table->tinyInteger('review_status')->default(0);
            $table->tinyInteger('dept_review_status')->default(0);
            $table->text('review_remark')->nullable();


            $table->string('cert_no', 30)->nullable()->comment('证书号');
            $table->date('complete_date')->nullable()->comment('完成日期');
            $table->date('publish_date')->nullable()->comment('发表日期');
            $table->string('rights_from', 50)->nullable()->comment('权利获得方式');
            $table->string('rights_scope', 50)->nullable()->comment('权利范围');
            $table->string('register_no', 20)->nullable()->comment('登记号');


            $table->string('cert')->nullable()->comment('专利证书');
            $table->integer('department_id')->default(0);
            $table->integer('user_id')->default(0);


            $table->year('year')->nullable()->comment('年份');
            $table->integer('serial_number')->default(0)->comment('序号');
            $table->timestamps();

            $table->index('year');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('book_applies');
    }
}
